[IA64] Fix qemu memory access on IA64
authorAlex Williamson <alex.williamson@hp.com>
Fri, 22 Feb 2008 15:40:32 +0000 (08:40 -0700)
committerAlex Williamson <alex.williamson@hp.com>
Fri, 22 Feb 2008 15:40:32 +0000 (08:40 -0700)
- Correct a parameter to xc_map_foreign_batch(). skipping vga hole.
- sync_icache() might overrun a page boundary. qemu-dm will die.

This re-enables HVM support after cset
99478ffd81ee8685e6376210a1bd654c3790bf8d in linux-2.6.18-xen.hg

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
tools/ioemu/hw/xen_machine_fv.c
tools/ioemu/target-i386-dm/exec-dm.c

index 272f67946fa41e55c80dac1385eee954939a65cc..2d02b5e13600c5229d0d6b8876b61878cfff1d01 100644 (file)
@@ -246,14 +246,20 @@ static void xen_init_fv(uint64_t ram_size, int vga_ram_size, char *boot_device,
 
     for (i = 0; i < nr_pages; i++)
         page_array[i] = i;
-       
+
     /* VTI will not use memory between 3G~4G, so we just pass a legal pfn
        to make QEMU map continuous virtual memory space */
-    if (ram_size > MMIO_START) {       
+    if (ram_size > MMIO_START) {
         for (i = 0 ; i < (MEM_G >> XC_PAGE_SHIFT); i++)
             page_array[(MMIO_START >> XC_PAGE_SHIFT) + i] =
                 (STORE_PAGE_START >> XC_PAGE_SHIFT); 
     }
+    /* skipping VGA hole, same as above */
+    if (ram_size > VGA_IO_START) {
+        for (i = 0 ; i < (VGA_IO_SIZE >> XC_PAGE_SHIFT); i++)
+            page_array[(VGA_IO_START >> XC_PAGE_SHIFT) + i] =
+                (STORE_PAGE_START >> XC_PAGE_SHIFT); 
+    }
 
     phys_ram_base = xc_map_foreign_batch(xc_handle, domid,
                                          PROT_READ|PROT_WRITE,
index f408a74c1e2025670d6e77f34c143455e2cea2e8..2ebdebff040cf5a7b75308f21588ab38b38a31c8 100644 (file)
@@ -350,12 +350,13 @@ CPUReadMemoryFunc **cpu_get_io_memory_read(int io_index)
  * So to emulate right behavior that guest OS is assumed, we need to flush
  * I/D cache here.
  */
-static void sync_icache(unsigned long address, int len)
+static void sync_icache(uint8_t *address, int len)
 {
-    int l;
+    unsigned long addr = (unsigned long)address;
+    unsigned long end = addr + len;
 
-    for(l = 0; l < (len + 32); l += 32)
-        __ia64_fc(address + l);
+    for (addr &= ~(32UL-1); addr < end; addr += 32UL)
+        __ia64_fc(addr);
 
     ia64_sync_i();
     ia64_srlz_i();